const db = require('./backend/db');

// 查看所有排班类型的applicable_type值
console.log('查询所有排班类型的applicable_type值...');
db.all('SELECT id, name, applicable_type FROM shift_types', (err, shiftTypes) => {
  if (err) {
    console.error('查询排班类型出错:', err.message);
    return;
  }
  console.log('排班类型数据:');
  shiftTypes.forEach(row => {
    console.log(`ID: ${row.id}, 名称: ${row.name}, applicable_type: ${row.applicable_type}`);
  });
  
  // 查看是否有type=3的员工
  console.log('\n查询是否有type=3的员工...');
  db.all('SELECT id, name, type FROM employees WHERE type = 3', (err, employees) => {
    if (err) {
      console.error('查询员工出错:', err.message);
      return;
    }
    if (employees.length > 0) {
      console.log('发现type=3的员工:');
      employees.forEach(emp => {
        console.log(`ID: ${emp.id}, 名称: ${emp.name}, type: ${emp.type}`);
      });
    } else {
      console.log('没有发现type=3的员工');
    }
    
    // 关闭数据库连接
    db.close();
  });
});